package cn.dazhou.networkdemo

import android.content.Context
import android.content.pm.PackageManager

object Utils {

    fun isSharedUserIdSystemApp(context: Context): Boolean {
        val packageName = context.packageName
        val packageManager = context.packageManager

        return try {
            val packageInfo = packageManager.getPackageInfo(packageName, 0)
            packageInfo.sharedUserId == "android.uid.system" // 普通App的sharedUserId为null
        } catch (e: PackageManager.NameNotFoundException) {
            false
        }
    }

}